home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / terms / kermit / b / ckvold.com < prev    next >
Encoding:
Text File  |  1992-12-08  |  12.5 KB  |  338 lines

  1. $! CKVOLD.COM - Build C-Kermit 5A on VMS 4.5.
  2. $! 
  3. $! This is DCL procedure builds C-Kermit on VMS systems that have TGV
  4. $! MultiNet TCP/IP support.  It also works on systems that do not have TGV
  5. $! MultiNet.  However, if you have a system with MultiNet installed, but
  6. $! you want to build C-Kermit without MultiNet support, you must define
  7. $! NET_OPT to be NONET before running this procedure.  See additional comments
  8. $! at the bottom.
  9. $!
  10. $! Meanwhile, this procedure needs a lot of work:
  11. $!
  12. $! 1. Remove dependencies on disk and directory names like $DUA0: and
  13. $!    [C-KERMIT] (why are they there anyway?).
  14. $! 2. Make all lines less than 80 characters long.
  15. $! 3. Find some better way to link with the MultiNet shared library.
  16. $! 4. Make better use of DCL to eliminate redundant sections.
  17. $! 5. The system() call can no longer be used as an excuse for having
  18. $!    a separate section for pre-2.4 versions of VAX C (C-Kermit no longer
  19. $!    calls the system() function).
  20. $! 6. Surprises when you change options and run this program again but the
  21. $!    options don't change because CC_OPTIONS is left behind from last time...
  22. $! etc etc etc.
  23. $! 
  24. $    SAVE_VERIFY = F$VERIFY(0'CKVKER_VERIFY')
  25. $!    ON CONTROL_Y THEN GOTO ABNORMAL_EXIT
  26. $    ON WARNING THEN GOTO ABNORMAL_EXIT
  27. $!
  28. $    delete = "delete"
  29. $       define = "define"
  30. $    define/nolog c$include sys$disk:[],dua0:[c-kermit]
  31. $    tmp = f$envirement("procedure")
  32. $    ckv_proc_loc = "c$include:"
  33. $    define/nolog 'ckv_proc_loc' 'f$parse(tmp,,,"DEVICE")' + -
  34.              'f$parse(tmp,,,"DIRECTORY")' + -
  35.             "dua0:[c-kermit]"
  36. $    if p1 .nes. "BATCH" then goto interactive
  37. $    f = f$search("''ckv_proc_loc'CKVKER.COM")
  38. $    if f .eqs. "" then goto interactive
  39. $    name =     f$parse(f,,,"name")
  40. $    log_file = F$PARSE(name + ".LOG")
  41. $    com_file = ckv_proc_loc + name + ".COM"
  42. $    submit/keep/noprint/log='log_file' 'com_file'-
  43.         /para=("''f$environment("default")'",-
  44.         "''p2'","''p3'","''p4'","''p5'","''p6'","''p7'","''p8'")
  45. $    write sys$output "Submitting file ''com_file'"
  46. $    exit
  47. $interactive:
  48. $    if f$mode() .nes. "BATCH" then goto no_batch
  49. $! running in batch
  50. $    if p1 .eqs. "" then goto no_batch    ! 25Oct90 - wb
  51. $    if p1 .eqs. "" then exit
  52. $    set def 'p1'
  53. $no_batch:
  54. $!
  55. $    define/nolog cms$lib dua0:[c-kermit]
  56. $    ckv_build_class == "V5A"
  57. $    vms_version = f$edit(f$getsyi("version"),"COMPRESS")
  58. $    vms_version = "VMS_V" + f$extract(1,1,vms_version) -
  59.         + f$extract(3,1,vms_version)
  60. $    objlib = "wermit"
  61. $    alternate = ""
  62. $    vckd_disk = "dua1:"
  63. $    vckd_library = "''vckd_disk'[sys0.syslib]"
  64. $    vckd_vaxc = "''vckd_disk'[sys0.sysexe]vaxc.exe"
  65. $    vckd_linker = "''vckd_disk'[sys0.sysexe]linker.exe"
  66. $!
  67. $    if p3 .nes. "ALTERNATE" then goto no_alternate_build
  68. $    alternate = "_v4"
  69. $    vms_version = "VMS_V46"
  70. $    define vaxc 'vckd_vaxc'
  71. $    define linker 'vckd_linker'
  72. $    define sys$library 'vckd_library'
  73. $    objlib = objlib + alternate
  74. $no_alternate_build:
  75. $    if vms_version .eqs. "VMS_V41" then vms_version = "VMS_V40"
  76. $    if vms_version .eqs. "VMS_V43" then vms_version = "VMS_V42"
  77. $    if vms_version .eqs. "VMS_V45" then vms_version = "VMS_V44"
  78. $    if vms_version .eqs. "VMS_V47" then vms_version = "VMS_V46"
  79. $    if vms_version .eqs. "VMS_V51" then vms_version = "VMS_V50"
  80. $!
  81. $! Define command to be used in conditionally compiling C sources.
  82. $!
  83. $    IF "''CCMAKE'" .EQS. "" THEN CCMAKE = "@''ckv_proc_loc'CKVMAK.COM"
  84. $!
  85. $! Look for MultiNet runtime library.
  86. $!
  87. $!    IF "''NET_OPT'" .NES. "" THEN GOTO GET_CC_VER
  88. $    NET_OPT = "NONET"
  89. $    IF F$SEARCH("MULTINET:MULTINET_SOCKET_LIBRARY.EXE") .NES. "" THEN -
  90.         NET_OPT = "MULTINET"
  91. $GET_CC_VER:
  92. $WRITE SYS$OUTPUT "Building C-Kermit 5A, ",NET_OPT," version."
  93. $!
  94. $! Determine which version of the C compiler is being used,
  95. $! and define version-specific stuff.
  96. $!
  97. $    CC_VER_OPTS = "/DEFINE=(""DEBUG"",""TLOG"",""DYNAMIC"",""VAXC030"",""''NET_OPT'"",""''VMS_VERSION'"",""CK_CURSES"")"
  98. $!    WRITE SYS$OUTPUT "CC_VER_OPTS = ",CC_VER_OPTS
  99. $    C_LIBRARY = "SYS$LIBRARY:VAXCRTL.OLB"        !V3 lib
  100. $    IF F$SEARCH("SYS$LIBRARY:VAXCPAR.OLB") .NES. "" THEN GOTO FOUND_LIB
  101. $!
  102. $! For V2.0 - V2.3 we will create a symbol VAXC023.  For V2.4 the symbol
  103. $! is VAXC024.  This seperation is needed as between V2.3 and V2.4 of VAXC,
  104. $! the function system() was added.  (NOTE: it was added to V4.6 in CRTL but
  105. $! uVMS systems would not get that so we are putting all V2.3 versions of C
  106. $! under the same hat - no system() call.
  107. $!
  108. $    VAXC_VERSION = "VAXC023"
  109. $    IF F$SEARCH("SYS$LIBRARY:FSCNDEF.H") .NES. "" THEN -
  110.         VAXC_VERSION = "VAXC024"
  111. $    CC_VER_OPTS = "/DEFINE=(""DEBUG"",""TLOG"",""DYNAMIC"",""''NET_OPT'"",""''VAXC_VERSION'"",""''VMS_VERSION'"",""CK_CURSES"")"
  112. $    WRITE SYS$OUTPUT "CC_VER_OPTS = ",CC_VER_OPTS
  113. $    C_LIBRARY = "SYS$LIBRARY:VAXCRTL.OLB"        !V2 lib
  114. $    IF F$SEARCH(C_LIBRARY) .NES. "" THEN GOTO FOUND_LIB
  115. $!
  116. $    CC_VER_OPTS = ""                !V1 options
  117. $    WRITE SYS$OUTPUT "CC_VER_OPTS = ",CC_VER_OPTS
  118. $    C_LIBRARY = "SYS$LIBRARY:CRTLIB.OLB"        !V1 lib
  119. $    IF F$SEARCH(C_LIBRARY) .NES. "" THEN GOTO FOUND_LIB
  120. $!
  121. $    WRITE SYS$OUTPUT "Unable to locate C Run-Time Library."
  122. $    GOTO ABNORMAL_EXIT
  123. $FOUND_LIB:
  124. $    WRITE SYS$OUTPUT "Using ",C_LIBRARY," as the C Run-Time Library."
  125. $!
  126. $! Define CC options to be used, if not explicitly supplied.
  127. $!
  128. $    IF f$type(CC_OPTIONS) .EQS. "" -
  129.       THEN CC_OPTIONS == "/DEBUG=TRACE/OPTIMIZE/NOLIST" + CC_VER_OPTS ! 4/10/91 wb changed to /nolist
  130. $    if f$type(cc_options) .nes. "" -
  131.       then cc_options == f$edit(cc_options,"upcase")
  132. $    WRITE SYS$OUTPUT "Using CC options: ",CC_OPTIONS,"."
  133. $!
  134. $! VMS specific files first
  135. $!
  136. $    CCMAKE CKVCON.C "" 'CC_OPTIONS' 'objlib'
  137. $    CCMAKE CKCNET.C "" 'CC_OPTIONS' 'objlib'
  138. $    CCMAKE CKVTIO.C "" 'CC_OPTIONS' 'objlib'
  139. $    CCMAKE CKVOLD.C "" 'CC_OPTIONS' 'objlib' ! 4/10/91 wb
  140. $    CCMAKE CKVFIO.C "" 'CC_OPTIONS' 'objlib'
  141. $!
  142. $    CCMAKE CKCFN2.C "" 'CC_OPTIONS' 'objlib'
  143. $    CCMAKE CKCFN3.C "" 'CC_OPTIONS' 'objlib'
  144. $    CCMAKE CKCFNS.C "" 'CC_OPTIONS' 'objlib'
  145. $    CCMAKE CKCMAI.C "" 'CC_OPTIONS' 'objlib'
  146. $!
  147. $    ckv_wart_present = (f$search("ckcpro.w") .nes. "")
  148. $    if .not. ckv_wart_present then -
  149.         cms fet/nohist/nolog ckcpro.w/gen='ckv_build_class' ""
  150. $    IF F$SEARCH("CKWART''alternate'.EXE") .EQS. ""    THEN GOTO DO_WART
  151. $!    IF F$SEARCH("CKCPRO.C") .EQS. ""    THEN GOTO DO_WART
  152. $!    IF F$SEARCH("CKCPRO.OBJ") .EQS. ""    THEN GOTO DO_WART
  153. $    if f$search("ckwart''alternate'.olb") .eqs. "" then -
  154.         libr/cre/obj ckwart'alternate'.olb
  155. $!    library/ext=ckcpro/output=ckcpro.obj ckwart'alternate'
  156. $!    SRC_TIME = F$FILE_ATTRIBUTES("CKCPRO.W", "CDT") ! get creation time
  157. $!    OUT_TIME = F$FILE_ATTRIBUTES("CKCPRO.OBJ", "CDT") ! for both files.
  158. $!    IF F$CVTIME(SRC_TIME) .GES. F$CVTIME(OUT_TIME) THEN GOTO DO_WART
  159. $    @'ckv_proc_loc'ckvcdt ckcpro.w 'objlib' ckv$flag
  160. $    if ckv$flag then goto do_wart
  161. $!    delete ckcpro.obj;
  162. $    WRITE SYS$OUTPUT "CKCPRO.OBJ", " is up to date."
  163. $    GOTO DONE_WART
  164. $DO_WART:
  165. $    IF F$SEARCH("CKWART''alternate'.EXE") .NES. "" THEN GOTO GOT_WART
  166. $    CCMAKE CKWART.C "" 'CC_OPTIONS' ckwart'alternate'
  167. $    WRITE SYS$OUTPUT "Linking WART..."
  168. $    LINK/EXECUTABLE=CKWART'alternate'/MAP=ckwart'alternate' -
  169.       ckwart'alternate'/lib/include=(CKWART),'C_LIBRARY'/LIBRARY
  170. $GOT_WART:
  171. $    WRITE SYS$OUTPUT "Executing WART..."
  172. $    WART = "$SYS$DISK:[]CKWART''alternate'"
  173. $    WART CKCPRO.W CKCPRO.C
  174. $    CCMAKE CKCPRO.C "" 'CC_OPTIONS' 'objlib'
  175. $    if .NOT. ckv_wart_present .and. f$search("ckcpro.w") .nes. "" then -
  176.         delete ckcpro.w;*
  177. $!    delete ckcpro.c;*
  178. $DONE_WART:
  179. $!
  180. $    CCMAKE CKUCMD.C "" 'CC_OPTIONS' 'objlib'
  181. $    CCMAKE CKUDIA.C "" 'CC_OPTIONS' 'objlib'
  182. $    CCMAKE CKUSCR.C "" 'CC_OPTIONS' 'objlib'
  183. $    CCMAKE CKUUS2.C "" 'CC_OPTIONS' 'objlib'
  184. $    CCMAKE CKUUS3.C "" 'CC_OPTIONS' 'objlib'
  185. $    CCMAKE CKUUS4.C "" 'CC_OPTIONS' 'objlib'
  186. $    CCMAKE CKUUS5.C "" 'CC_OPTIONS' 'objlib'
  187. $    CCMAKE CKUUS6.C "" 'CC_OPTIONS' 'objlib'
  188. $    CCMAKE CKUUS7.C "" 'CC_OPTIONS' 'objlib'
  189. $    CCMAKE CKUUSR.C "" 'CC_OPTIONS' 'objlib'
  190. $    CCMAKE CKUUSX.C "" 'CC_OPTIONS' 'objlib'
  191. $    CCMAKE CKUUSY.C "" 'CC_OPTIONS' 'objlib'
  192. $    CCMAKE CKUXLA.C "" 'CC_OPTIONS' 'objlib'
  193. $    IF "''NET_OPT'" .EQS. "MULTINET" THEN GOTO LINK_TGV
  194. $    WRITE SYS$OUTPUT "Linking WERMIT..."
  195. $    LINK'p2'/MAP=wermit'alternate'/sym/EXECUTABLE=WERMIT'alternate' -
  196.       'objlib'/library -
  197.         /include=( -
  198.             CKCFN2,-
  199.             CKCFN3,-
  200.             CKCFNS,-
  201.             CKCMAI,-
  202.             CKCPRO,-
  203.             CKUCMD,-
  204.             CKUDIA,-
  205.               CKUSCR,-
  206.             CKUUS2,-
  207.             CKUUS3,-
  208.             CKUUS4,-
  209.             CKUUS5,-
  210.             CKUUS6,-
  211.             CKUUS7,-
  212.             CKUUSR,-
  213.             CKUXLA,-
  214.             CKVCON,-
  215.             CKCNET,-
  216.             CKVFIO,-
  217.             CKVOLD,- ! 4/10/91 wb
  218.             CKVTIO), -
  219. - !      SYS$LIBRARY:VAXCCURSES/LIBRARY, - ! 7/2/92 wb
  220.       'C_LIBRARY'/LIBRARY
  221. $    GOTO NORMAL_EXIT
  222. $LINK_TGV:
  223. $! Somebody who knows something about VMS please improve this.
  224. $! In order to link Kermit with the MultiNet runtime library,
  225. $! the /SHARE qualifier must be used.  But /SHARE cannot be specified
  226. $! on the LINK command line, so it must be put into an options file.
  227. $! So here we call upon CKVKER.OPT to do the linking.  However, when
  228. $! LINK is invoked in this way, it refuses to do the linking because
  229. $! "%LINK-F-FIRSTMOD, first input file being a library requires module
  230. $! extraction".  So here we yank CKCMAI.OBJ back out of the library
  231. $! and then call LINK with the options file.
  232. $!
  233. $! The options file looks like this:
  234. $!
  235. $! CKCMAI
  236. $! WERMIT.OLB/LIBRARY/INCLUDE=(CKCFN2,CKCFN3,CKCFNS,CKCPRO,-
  237. $! CKUCMD,CKUDIA,CKUSCR,CKUUS2,CKUUS3,CKUUSR,CKUXLA,CKVCON,CKCNET,CKVFIO,-
  238. $! CKVTIO)
  239. $! SYS$LIBRARY:VAXCRTL.OLB /LIBRARY
  240. $! MULTINET:MULTINET_SOCKET_LIBRARY.EXE /SHARE
  241. $! 
  242. $    WRITE SYS$OUTPUT "Linking with MultiNet"
  243. $    IF F$SEARCH("CKCMAI.OBJ") .NES. "" THEN GOTO DO_LINK_TGV
  244. $! Borrow CKCMAI.OBJ from the library...
  245. $    LIBRARY /EXTRACT=CKCMAI /OUTPUT=CKCMAI.OBJ WERMIT.OLB
  246. $    LIBRARY /DELETE=CKCMAI WERMIT.OLB
  247. $DO_LINK_TGV:
  248. $    LINK /EXECUTABLE=WERMIT.EXE CKVKER /OPT
  249. $! Now return CKCMAI.OBJ to the library.
  250. $!    LIBRARY /INSERT=CKCMAI.OBJ;0 WERMIT.OLB
  251. $!    DELETE CKCMAI.OBJ;*
  252. $    GOTO NORMAL_EXIT
  253. $!
  254. $! Abnormal exit.
  255. $!
  256. $ABNORMAL_EXIT:
  257. $    STATUS = $STATUS            !save failure status
  258. $    IF STATUS THEN STATUS = "%X08000002"    !force error if neccessary
  259. $    GOTO EXIT
  260. $!
  261. $! Normal exit.
  262. $!
  263. $NORMAL_EXIT:
  264. $    STATUS = $STATUS            !save success status
  265. $!
  266. $! Exit.
  267. $!
  268. $EXIT:
  269. $    if f$trnlnm("cms$lib","lnm$process") then deassign cms$lib
  270. $    if f$trnlnm("sys$library","lnm$process") .nes. "" then -
  271.         deassign sys$library
  272. $    if f$trnlnm("linker","lnm$process") .nes. "" then deassign linker
  273. $    if f$trnlnm("vaxc","lnm$process") .nes. "" then deassign vaxc
  274. $    EXIT ('STATUS' .OR. %X10000000) + F$VERIFY(SAVE_VERIFY) * 0
  275. $!
  276. $! CKVKER.COM    2.0 (004) 9-Apr-1991
  277. $!
  278. $! Build C-Kermit 5A.
  279. $!
  280. $! Note: this command file implements a very limited "make" capability.
  281. $! If you change CKWART.C, you must delete CKWART.EXE.
  282. $! If you change any header files, you must delete all .OBJ files.
  283. $!
  284. $! IF YOU HAVE TROUBLE COMPILING OR RUNNING SOME OF THE GENERATED CODE,
  285. $! TRY COMPILING WITHOUT OPTIMIZATION.
  286. $!
  287. $! input:
  288. $!    CKVKER_VERIFY    If defined and positive, causes verification
  289. $!            of this command file.
  290. $!    CC_OPTIONS    Optional list of qualifiers for use when compiling
  291. $!            (e.g., "/list/debug=all", "/define=xxx", etc.).
  292. $!            Remember to enclose symbol names, etc. in quotes
  293. $!            so that DCL won't convert them to uppercase.
  294. $!    NET_OPT        If defined, overrides this file's automatic selection
  295. $!            selection of network support.
  296. $!
  297. $!    @ckvker    [batch] [link_qual] [alternate]
  298. $!
  299. $!    @ckvker    "BATCH" "/DEBUG" "ALTERNATE"
  300. $!        Will build wermit in batch, with the image linked
  301. $!        with the debugger for V4
  302. $!
  303. $!    @ckvker    "BATCH"
  304. $!        Will build wermit in batch without the debugger
  305. $!        for current version.
  306. $!
  307. $! Modifications:
  308. $!
  309. $!    12-Feb-89    Add C V3 support.
  310. $!                MAB
  311. $!
  312. $!    25-Jun-85    Allow external specification of CC options, and
  313. $!            provide some defaults.
  314. $!                            -- Dan Schullman
  315. $!
  316. $!    24-Jun-85    Automatically determine C Run-Time library to use.
  317. $!            Save and restore verification, and exit on errors.
  318. $!            Display additional "progress" information.
  319. $!            Avoid use of LNK$LIBRARY in case user had it defined.
  320. $!            Use CCMAKE to compile CKCPRO and CKWART.
  321. $!                            -- Dan Schullman
  322. $!  DEC/CMS REPLACEMENT HISTORY, Element CKVKER.COM
  323. $!  *14    8-APR-1991 19:48:00 fdc  "Add CKCNET and MultiNet support"
  324. $!  *13   10-MAY-1990 09:11:25 BUDA "Add CKUXLA to link command"
  325. $!  *12    9-MAY-1990 22:20:31 BUDA "Add V5A support"
  326. $!  *11   29-AUG-1989 00:35:35 BUDA "Add version code"
  327. $!  *10   23-APR-1989 20:41:46 BUDA "Do not delete CKCPRO.C"
  328. $!  *9    23-APR-1989 17:23:10 BUDA "Dont compile CKCPRO.W unless date change"
  329. $!  *8    17-APR-1989 00:46:19 BUDA "Fix where output files go"
  330. $!  *7    17-APR-1989 00:32:52 BUDA "Fix where log file is placed"
  331. $!  *6    16-APR-1989 22:59:36 BUDA "Find alternate location"
  332. $!  *5    16-APR-1989 17:55:23 BUDA "General clean up"
  333. $!  *4    11-APR-1989 23:40:08 BUDA "Fix build class"
  334. $!  *3    11-APR-1989 23:32:32 BUDA "Automatically find called procedures"
  335. $!  *2    11-APR-1989 23:25:07 BUDA "Add CMS support"
  336. $!  *1    11-APR-1989 22:56:11 BUDA "Initial creation"
  337. $!  DEC/CMS REPLACEMENT HISTORY, Element CKVKER.COM
  338.